package unclassified.medium;

public class LCOF_04 {

    public boolean findNumberIn2DArray(int[][] matrix, int target) {
        for (int[] ints : matrix) {
            int l = 0, r = ints.length - 1;
            while (l <= r) {
                int mid = l + (r - l) / 2;
                if (ints[mid] < target) {
                    l = mid + 1;
                } else if (ints[mid] > target) {
                    r = mid - 1;
                } else {
                    return true;
                }
            }
        }
        return false;
    }
}
